﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web.UI;

namespace Kevin.Controls
{
    /// <summary>
    /// 客户端绑定项
    /// </summary>
    internal class ClientBindItem
    {
        public ClientBindItem()
        { }

        public ClientBindItem(string propertyName, string getClientControlDataMethod, string clearClientControlDataMethod)
        {
            //将服务器端控件转换为客户端控件
            this.Name = propertyName;
            this.Method = getClientControlDataMethod;
            this.ClearMethod = clearClientControlDataMethod;
        }

        /// <summary>
        /// 客户端ID
        /// </summary>
        public string ID
        {
            get;
            set;
        }

        /// <summary>
        /// 实体的属性名称
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// 从客户端获取数据的javascript方法
        /// </summary>
        public string Method
        {
            get;
            set;
        }
        /// <summary>
        /// 清空客户端控件数据的javascript方法
        /// </summary>
        public string ClearMethod
        {
            get;
            set;
        }
        /// <summary>
        /// 是否为主键
        /// </summary>
        public bool IsPrimaryKey
        {
            get;
            set;
        }

        

    }

    /// <summary>
    /// 客户端绑定项集合
    /// </summary>
    internal class ClientBindItemCollection : CollectionBase
    {
        public int Add(ClientBindItem item)
        {
           return base.List.Add(item);
        }

        public void Remove(ClientBindItem item)
        {
            base.List.Remove(item);
        }

        public ClientBindItem this[int index]
        {
            get { return (ClientBindItem)base.List[index]; }
            
        }

        public int Count
        {
            get { return base.List.Count; }
        }
    }
}
